package com.zy.net.retrofit

import com.zy.net.NetServiceImpl
import com.zy.net.NetServiceInterface
import com.zy.net.data.DataRecord
import okhttp3.Callback
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import okhttp3.Response
import retrofit2.Retrofit


internal object RetrofitImpl {

    private var retrofit: Retrofit = Retrofit.Builder().baseUrl(NetServiceImpl.HOST.toHttpUrl())
        .addConverterFactory(RetrofitFactory.FACTORY)
        .build()

    private val service: ZYWorldService = retrofit.create(
        ZYWorldService::class.java
    )


    fun getAllStr(callback: retrofit2.Callback<String>) {
        service.allStr.enqueue(callback)
    }

    fun getAll(callback: retrofit2.Callback<DataRecord>) {
        service.all.enqueue(callback)
    }

}